package com.shilun.demo.demo.swagger.controller;

import com.shilun.demo.demo.swagger.service.UserService;
import com.shilun.demo.demo.swagger.vo.ResultVo;
import com.shilun.demo.demo.swagger.vo.UserVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author sl shilun217@qq.com
 * @Deacription
 * @date 2021/12/04/23:40
 **/
@Api(tags = "用户")
@RestController
@RequestMapping("/user")
@Log4j2
public class UserController {
    @Autowired
    private UserService userService;

    @ApiOperation(value = "添加用户")
    @PostMapping("/add")
    public ResultVo addUser(@RequestBody @Valid UserVo user){
        userService.addUser(user);
        return ResultVo.success();
    }
}
